package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.ReportBalance;
import com.sc.nft.entity.vo.PageReportTransferVO;
import com.sc.nft.entity.vo.ReportTransferVO;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.ReportTransfer;
import com.sc.nft.mapper.ReportTransferMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_report_transfer)数据DAO
 *
 * @author Sun
 * @since 2023-02-21 13:30:02
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class ReportTransferDao extends ServiceImpl<ReportTransferMapper, ReportTransfer> {

    public ReportTransfer getReportTransfer() {
        LambdaQueryWrapper<ReportTransfer> wrapper = new LambdaQueryWrapper<>();
        wrapper.last("order by id desc limit 1");
        return getOne(wrapper);
    }

    public Page<PageReportTransferVO> getPageReportTransfer(Page page, Integer type, String beginTime, String endTime) {
        return baseMapper.getPageReportTransfer(page,type,beginTime,endTime);
    }

    public Boolean getByTime(String time) {
        List<ReportTransfer> list = baseMapper.getByTime(time);
        if(list.size() >0){
            return Boolean.TRUE;
        }
        return Boolean.FALSE;
    }
}